<template>
  <card-layout title="卷帘对比" bg="3" class="chart">
    <template #extra>
      <el-icon class="extra-more" :size="22" @click="onClose">
        <Close />
      </el-icon>
    </template>
    <div class="curtain-comparison">
      <div class="comparison-content">
        <!-- 数据类型选择 -->
        <div class="data-type-section">
          <div class="section-title">数据类型</div>
          <div class="radio-group">
            <label class="radio-item">
              <input type="radio" v-model="dataType" value="data" name="dataType" />
              <span class="radio-label">数据类型</span>
            </label>
            <label class="radio-item">
              <input type="radio" v-model="dataType" value="orthophoto" name="dataType" />
              <span class="radio-label">正射影像</span>
            </label>
          </div>
        </div>

        <!-- 日期选择 -->
        <div class="date-selection-section">
          <div class="date-group">
            <div class="date-item">
              <div class="date-label">左侧数据</div>
              <el-select v-model="leftDate" placeholder="请选择日期" class="date-select">
                <el-option
                  v-for="date in dateOptions"
                  :key="date.value"
                  :label="date.label"
                  :value="date.value"
                />
              </el-select>
            </div>
            <div class="date-item">
              <div class="date-label">右侧数据</div>
              <el-select v-model="rightDate" placeholder="请选择日期" class="date-select">
                <el-option
                  v-for="date in dateOptions"
                  :key="date.value"
                  :label="date.label"
                  :value="date.value"
                />
              </el-select>
            </div>
          </div>
        </div>

        <!-- 操作按钮 -->
        <div class="action-buttons">
          <el-button class="close-btn" @click="onClose">关闭</el-button>
          <el-button type="primary" class="compare-btn" @click="startComparison">开始对比</el-button>
        </div>
      </div>
    </div>
  </card-layout>
</template>

<script setup>
import { ref } from "vue";
import { Close } from "@element-plus/icons-vue";

const emits = defineEmits(["close"]);

// 数据类型选择
const dataType = ref("orthophoto");

// 日期选择
const leftDate = ref("2025/06/12大人工巨坑");
const rightDate = ref("2025/08/12大人工巨坑");

// 日期选项
const dateOptions = [
  { label: "2025/06/12大人工巨坑", value: "2025/06/12大人工巨坑" },
  { label: "2025/08/12大人工巨坑", value: "2025/08/12大人工巨坑" },
  { label: "2024/12/15大人工巨坑", value: "2024/12/15大人工巨坑" },
  { label: "2024/10/20大人工巨坑", value: "2024/10/20大人工巨坑" },
];

// 关闭弹窗
const onClose = () => {
  emits("close");
};

// 开始对比
const startComparison = () => {
  console.log("开始对比", {
    dataType: dataType.value,
    leftDate: leftDate.value,
    rightDate: rightDate.value,
  });
  // 这里可以添加实际的对比逻辑
};
</script>

<style lang="scss" scoped>
.chart {
  height: 100%;
}

.curtain-comparison {
  background-color: transparent;
  color: #333;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 20px;

  .comparison-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-sizing: border-box;

    .data-type-section {
      .section-title {
        font-size: 14px;
        color: #fff;
        font-weight: 300;
        margin-bottom: 12px;
      }

      .radio-group {
        display: flex;
        gap: 20px;

        .radio-item {
          display: flex;
          align-items: center;
          cursor: pointer;
          user-select: none;

          input[type="radio"] {
            margin-right: 8px;
            accent-color: #00d4aa;
          }

          .radio-label {
            font-size: 12px;
            color: #dedede;
            transition: color 0.2s;
          }

          &:hover .radio-label {
            color: #fff;
          }
        }
      }
    }

    .date-selection-section {
      .date-group {
        display: flex;
        flex-direction: column;
        gap: 16px;

        .date-item {
          display: flex;
          align-items: center;
          gap: 12px;

          .date-label {
            font-size: 12px;
            color: #dedede;
            min-width: 60px;
          }

          .date-select {
            flex: 1;
            max-width: 200px;

            :deep(.el-input__wrapper) {
              background-color: rgba(255, 255, 255, 0.1);
              border: 1px solid rgba(255, 255, 255, 0.2);
              border-radius: 6px;
              box-shadow: none;

              .el-input__inner {
                color: #fff;
                font-size: 12px;

                &::placeholder {
                  color: #999;
                }
              }

              .el-input__suffix {
                .el-input__suffix-inner {
                  .el-select__caret {
                    color: #999;
                  }
                }
              }
            }

            &:hover :deep(.el-input__wrapper) {
              border-color: rgba(0, 212, 170, 0.5);
            }

            &.is-focus :deep(.el-input__wrapper) {
              border-color: #00d4aa;
              box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.2);
            }
          }
        }
      }
    }

    .action-buttons {
      display: flex;
      justify-content: center;
      gap: 12px;
      margin-top: 20px;

      .close-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: #dedede;
        padding: 8px 20px;
        border-radius: 6px;
        font-size: 12px;
        transition: all 0.2s;

        &:hover {
          border-color: rgba(255, 255, 255, 0.5);
          color: #fff;
          background: rgba(255, 255, 255, 0.05);
        }
      }

      .compare-btn {
        background: #00d4aa;
        border: 1px solid #00d4aa;
        color: #fff;
        padding: 8px 20px;
        border-radius: 6px;
        font-size: 12px;
        transition: all 0.2s;

        &:hover {
          background: #00c299;
          border-color: #00c299;
        }
      }
    }
  }
}

// 下拉框选项样式
:deep(.el-select-dropdown) {
  background-color: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  .el-select-dropdown__item {
    color: #dedede;
    font-size: 12px;
    padding: 8px 12px;

    &:hover {
      background-color: rgba(0, 212, 170, 0.1);
      color: #00d4aa;
    }

    &.selected {
      background-color: rgba(0, 212, 170, 0.2);
      color: #00d4aa;
      font-weight: 500;
    }
  }
}
</style>